"""
:create time: 2020/1/18 16:23 
:author: may
:desc: 用于查询数据库返回数据的格式化
"""


def to_str(rows):
    """查询数据库返回数据中的非字符串类型转为字符串"""
    for row in rows:
        for i in range(len(row)):
            if not isinstance(row[i], str):
                row[i] = str(row[i])
    return rows


def to_list(rows):
    """查询数据库fetchall()返回list中的tuple转为list"""
    for i in range(len(rows)):
        rows[i] = list(rows[i])
        rows[i].sort()
    return rows
